//
//  SPVerticalLayoutLabelView.m
//  panzer
//
//  Created by 还带大道 on 2018/10/24.
//  Copyright © 2018年 还带大道. All rights reserved.
//

#import "SPVerticalLayoutLabelView.h"

@implementation SPVerticalLayoutLabelView

- (instancetype)initWithFrame:(CGRect)frame
{
    if(self = [super initWithFrame:frame]){

        _topLabel_topMargin = 10;
        _bottomLabel_topMargin = 5;
        
        UILabel *topLabel = [UILabel new];
        topLabel.textAlignment = NSTextAlignmentCenter;
        _topLabel = topLabel;
        [self addSubview:topLabel];
        
        UILabel *bottomLabel = [UILabel new];
        bottomLabel.textAlignment = NSTextAlignmentCenter;
        _bottomLabel = bottomLabel;
        [self addSubview:bottomLabel];
        
    }
    return self;
}



- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.topLabel sizeToFit];
    [self.bottomLabel sizeToFit];
    
    self.topLabel.frame = CGRectMake(0, _topLabel_topMargin, self.frame.size.width, self.topLabel.frame.size.height);
    self.bottomLabel.frame = CGRectMake(0, CGRectGetMaxY(self.topLabel.frame)+_bottomLabel_topMargin, self.frame.size.width, self.bottomLabel.frame.size.height);
}

@end
